#include <stdio.h>
#include <string.h>

#include "linklist.h"

DataNode* FindCmd(DataNode *head, const char *cmd)
{
    if(NULL == head || NULL == cmd) return NULL;
    
    DataNode *p = head;
    while(NULL != p)
    {
        if(0 == strcmp(cmd, p->cmd))
            break;
        
        p = p->next;
    }
    
    return p;
}

void ShowAllCmd(DataNode *head)
{
    printf("Menu List:\n");
    
    DataNode *p = head;
    while(NULL != p)
    {
        printf("%-10s - %s\n", p->cmd, p->desc);
        p = p->next;
    }
}